package com.weilian.ordering.common;

import android.content.Context;
import android.view.animation.AnimationUtils;
import android.widget.ViewFlipper;

import com.weilian.ordering.R;

/**
 * Page Change Style
 * @author Sojex 
 */
public class Style {
	static Context context;
	/** default style */
	public static final int DEFAULT_STYLE = 0; //
	/** up down style */
	public static final int UP_DOWN_STYLE = 1; //
	/** up down close in center style */
	public static final int UP_DOWN_CENTER_STYLE = 2;//
	/** left right close in center style */
	public static final int LEFT_RIGHT_CENTER_STYLE = 3;//
	/** override style */
	public static final int OVERRIDE_STYLE = 4;//
	/** around style */
	public static final int AROUND_STYLE = 5;//
	/** open door style */
	public static final int OPEN_DOOR_STYLE = 6;
	/** next page code */
	public static final int NEXT = 1;
	/** previous page code */
	public static final int PREVIOUS = -1;

	/** default style next page code */
	public static final int DEFAULT_STYLE_NEXT = 1; 
	/** default style previous page code */
	public static final int DEFAULT_STYLE_PREVIOUS = -DEFAULT_STYLE_NEXT;  

	/** up down style next page code */
	public static final int UP_DOWN_STYLE_NEXT = 2;
	/** up down style previous page code*/
	public static final int UP_DOWN_STYLE_PREVIOUS = -UP_DOWN_STYLE_NEXT;

	/** up down close in center style next page code */
	public static final int UP_DOWN_CENTER_STYLE_NEXT = 3;  
	/** up down close in center style previous page code*/
	public static final int UP_DOWN_CENTER_STYLE_PREVIOUS = -UP_DOWN_CENTER_STYLE_NEXT; 

	/** left right close in center style next page code*/
	public static final int LEFT_RIGHT_CENTER_STYLE_NEXT = 4; 
	/** left right close in center style previous page code*/
	public static final int LEFT_RIGHT_CENTER_STYLE_PREVIOUS = -LEFT_RIGHT_CENTER_STYLE_NEXT; 

	/** override style next page code */
	public static final int OVERRIDE_STYLE_NEXT = 5; 
	/** override style previous page code */
	public static final int OVERRIDE_STYLE_PREVIOUS = -OVERRIDE_STYLE_NEXT; 

	/** around style next page code */
	public static final int AROUND_STYLE_NEXT = 6; 
	/** around style previous page code*/
	public static final int AROUND_STYLE_PREVIOUS = -AROUND_STYLE_NEXT; 

	/** open door next page code */
	public static final int OPEN_DOOR_NEXT = 7; 
	/** open door previous page code */
	public static final int OPEN_DOOR_PREVIOUS = -OPEN_DOOR_NEXT; 

	/**
	 * turn page style
	 * 
	 * @param c
	 *            Context
	 * @param styleId
	 *            style id
	 * @param flipper
	 *            ViewFlipper
	 * @return
	 */
	public static ViewFlipper turnPage(Context c, int styleId,
			ViewFlipper flipper) {
		context = c;
		switch (styleId) {
		// default style
		case Style.DEFAULT_STYLE_NEXT:
			flipper.setInAnimation(AnimationUtils.loadAnimation(c,
					R.anim.push_left_in));
			flipper.setOutAnimation(AnimationUtils.loadAnimation(c,
					R.anim.push_left_out));
			break;
		case Style.DEFAULT_STYLE_PREVIOUS:
			flipper.setInAnimation(AnimationUtils.loadAnimation(c,
					R.anim.push_right_in));
			flipper.setOutAnimation(AnimationUtils.loadAnimation(c,
					R.anim.push_right_out));
			break;
		}
		return flipper;
	}
}